using FM_Mono;
using UnityEngine;

namespace FibMatrix
{
    public partial class AbstractResourceFacadeImpl
    {
        [IgnoreGen]
        public void InspectorGUI()
        {
            // all load items
            var iter = GetLoadItemEnumerator();
            while (iter.MoveNext())
            {
                var key = iter.Current.Key.Replace(BundleResourceFacadeImpl.PROJECT_DYNAMIC_RESOURCE_ROOT, "");
                var value = iter.Current.Value;

                if (value.objRefCount == 0)
                {
                    GUILayout.Label($"{key}, unloaded.");
                }
                else if (value.inRecycle)
                {
                    var remainDestroyTime = value.destoryTime - FibMatrix.RealTimer.elapsedSeconds;
                    GUILayout.Label($"{key}, {value.objRefCount}, in recycle. {remainDestroyTime:F2}");
                }
                else
                {
                    GUILayout.Label($"{key}, {value.objRefCount}, {value.assetHandle?.asset}");
                }
            }
        }
    }
}
